***********************************************
*************** OUTSTANDING DEBT **************
***********************************************
/*
In this do file, we import and prepare the data on
debt issuance and principal.

*/

*----------------
* PATHS
*----------------
global replication `c(pwd)'
global data "$replication\Data"
global inter "$replication\Dta - Intermediate"
global final "$replication\Dta - Final"
global graphs "$replication\Graphs"

*================
* IMPORTING DATA
*================
import excel "$data\Outstanding_MonthlyAggregation.xlsx", sheet("Sheet1") firstrow clear

*================
* MONTHLY DATA
*================
* Date variables
gen date = date(Dates, "MY")
drop Dates
g my=mofd(date)
label var my "Issuance Month Year"

format my %tm
tsset my

save "$final\Oustanding_MonthlyAggregation.dta", replace

*================
* QUARTERLY DATA
*================
g qy=qofd(date)
collapse (sum) issuance principal, by(qy)
save "$final\Oustanding_QuarterlyAggregation.dta", replace
